        extern printf
        section .data
fmt:    
        db "RSP: 0x%8x", 0xA, 0
        section .text
        global main
main:
        mov rcx, 0x0
        call stack
        
        mov rcx, 0x1
        call stack

        mov rcx, 0x2
        call stack
        
        mov rcx, 0x3
        call stack
        
        mov rcx, 0x4
        call stack
        
        mov rax, 0x3C
        mov rdi, 0x0
        syscall

stack:
        test rcx, rcx
        jz print
        mov rbx, rcx
prepare:
        push rcx
        loop prepare
print:
        mov rdi, fmt
        mov rsi, rsp
        mov rax, 0
        call printf
        mov rax, 8
        mul rbx
        add rsp, rax
        ret


